<html xmlns="http://www.w3.org/1999/xhtml">
<?php 
	if(!isset($_SESSION['userIdZing']))
	{
		session_start(); 
	}
	if(isset($_SESSION['userIdZing']))
	{
	?>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="./css/bootstrap.css" rel="stylesheet">

	<link href="./css/grid.css" rel="stylesheet">
	<link href="./css/carousel.css" rel="stylesheet">
	<link href="./css/search.css" rel="stylesheet">
	<link type="text/css" rel="stylesheet" href="css/style.css" />
	
	<script src="https://code.jquery.com/jquery-1.10.2.min.js"></script>
	<title>ZiGo</title>
</head>
<body>
<div id="zigo_container">
	<?php
		include ('/view/menutop.php');
		
	?>
	
    <div id="container">
        <div class="data"></div>
     	<div class="pagination"></div>
    </div> 
	<div id="loading"></div>
</div>
<script>
	
    //PHƯƠNG THỨC SHOW HÌNH LOADING
    function loading_show(){
        $('#loading').html("<img src='./images/bx_loader.gif'/>").fadeIn('fast');
    }

    // PHƯƠNG THỨC ẨN HÌNH LOADING
    function loading_hide(){
        $('#loading').fadeOut('fast');
    }             

    // PHƯƠNG THỨC LOAD KẾT QUẢ 
    function loadData(page){
        loading_show();                    
        $.ajax
        ({
            type: "GET",
            url: "http://localhost/zigo/WebservicePHPonweb/load_data_report.php",
            data: {
					'page': page
			},
			//dataType: "json",
            success: function(msg)
            {
				//console.log('success');
//$("#container").ajaxComplete(function(event, request, settings)
                //{
                    loading_hide();
                    $("#container").html(msg);
                //});
				reSizeHeigh();
            },
			error:function(data){
				console.log(data);
				alert("fail");
			}
        });
    }

    

    // LOAD KẾT QUẢ CHO TRANG
    $('#container .pagination li.active').click(function(){
        var page = $(this).attr('p');
		console.log(page);
        loadData(page);
    });  
	function loadMoreData(li){
		var page = li.id;
		console.log(page);
		loadData(page);
	}
	// LOAD GIÁ TRỊ MẶC ĐỊNH PAGE = 1 CHO LẦN ĐẦU TIÊN
    loadData(1);  
</script>
</body>
<?php }?>
</html>